package com.whq.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class Users {
    @Scope("prototype")
    @Bean
    public User user1(){
        User user = new User();
        user.setAge(1);
        user.setName("whq");
        user.setSex("male");
        return user;
    }

    @Bean
    public User user2(){
        User user = new User();
        user.setAge(2);
        user.setName("bigdog");
        user.setSex("male");
        return user;
    }

    private User user;

//    @Autowired
//    public void set(User us){
//        this.user = us;
//    }

    @Autowired
    public Users(User user) {
        this.user = user;
    }

    public User getUser(){
        return user;
    }
}
